package org.zfes.snowier.zbss.xzy.router.zmd;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.zfes.snowier.core.data.DataSet;
import org.zfes.snowier.web.controller.BaseController;
import org.zfes.snowier.zbss.xzy.biz.zmd.model.ModataMem;
import org.zfes.snowier.zbss.xzy.biz.zmd.service.IModataMemService;
import org.zfes.snowier.core.data.SelectVo;
@Controller 
@RequestMapping("/xzy")
public class ModataMemController implements BaseController {

	
	@Autowired
	private IModataMemService modataMemService;
	
	//@RequiresPermissions(value="modataMem:loadModataMemDataSet",desc="监控内存列表")
    @RequestMapping(value="/loadModataMemDataSet", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public @ResponseBody  Object loadModataMemDataSet(@RequestBody Map<String,Object> params){
	    DataSet dataSet=  modataMemService.loadModataMemDataSet(params);
	    return ajaxQuery("dataSet", dataSet);
    }
	
	//@RequiresPermissions(value="modataMem:createModataMem",desc="监控内存添加")
    @RequestMapping(value="/createModataMem", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public  @ResponseBody Object createModataMem(@RequestBody ModataMem modataMem){
		modataMemService.createModataMem(modataMem);
    	return ajaxDoneSuccess("数据操作成功 ");
    }
	
	//@RequiresPermissions(value="modataMem:loadModataMem",desc="监控内存加载")
    @RequestMapping(value="/loadModataMem/{id}", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public @ResponseBody  Object loadModataMem(@PathVariable("id")Long id){
		Optional<ModataMem> ops = modataMemService.loadModataMemById(id);
		return ajaxQuery("modataMem",ops);
    }
	
	//@RequiresPermissions(value="modataMem:updateModataMem",desc="监控内存更新")
    @RequestMapping(value="/updateModataMem", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public @ResponseBody  Object updateModataMem(@RequestBody  ModataMem modataMem){
		modataMemService.updateModataMem(modataMem);
		return ajaxDoneSuccess("数据操作成功 ");
    }
	
	//@RequiresPermissions(value="modataMem:deletModataMem",desc="监控内存删除")
    @RequestMapping(value="/deleteModataMem/{id}", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public @ResponseBody  Object deleteModataMem(@PathVariable("id")Long id){
		modataMemService.deleteModataMem(id);
		return ajaxDoneSuccess("数据操作成功 ");
    }


    @RequestMapping(value="/loadModataMemSelectVo", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public @ResponseBody  Object loadModataMemSelectVo(){
		 List<SelectVo>  ops = modataMemService.loadModataMemSelectVo("");
		return ajaxQuery("selectVo",ops);
    }
    
}